package community.hospital.entity.request;

import community.hospital.annotation.CheckState;
import community.hospital.annotation.IsIdCard;
import community.hospital.annotation.IsPhone;
import community.hospital.common.Add;
import community.hospital.common.Update;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;


/**
 * @Author：ydj
 * @Date：2023/1/16 17:05
 */
@Data
public class AddUserRequest implements Serializable {
    private static final long serialVersionUID = -7152503497109521157L;

    @NotBlank(message = "用户名不能为空")
    private String username;
    @NotBlank(message = "密码不能为空")
    private String password;
    @NotBlank(message = "账号不能为空")
    @Size(min = 6,max = 16,message = "账户应在6-16位之间")
    private String account;
    @NotBlank(message = "身份证不能为空")
    @IsIdCard
    private String idCard;
    @NotBlank(message = "手机号不能为空")
    @IsPhone
    private String phone;

    private String avatar;

    @NotNull(groups = {Add.class, Update.class},message = "状态不能为空")
    @CheckState(groups = {Add.class,Update.class})
    private Integer state;

    private Long roleId;

}
